Skip to content

fix(cargo-target-janitor): page queue_claims by keyset, not offset (#6790) - #6793

Merged
dezren39 merged 1 commit into
mainfrom
queue/6790-janitor-keyset
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6790-janitor-keyset

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

What

Fixes issue #6790: queue_claims in the cargo-target janitor read the pilot queue's claimed task IDs — its never-delete set — with limit/offset paging and no order=. PostgREST re-evaluates offset against the current filtered set on every request, and the claimed set is live: when a task left the set mid-read, every later row shifted one position forward and the next offset page skipped exactly one still-claimed task. That task's cargo target lost its never-delete protection at both call sites (the plan-time read and the apply-loop re-check use the same function). #6618 made the read complete-or-fail-closed for a static set; this closes the changing-set axis.

Change

Verification

Fixes #6790.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Issue #6790: offset pagination over the live claimed set is unstable — PostgREST re-evaluates offset against the current filtered set per request, so a task leaving the set mid-read shifted later rows forward and the next page skipped a still-claimed task, dropping its target from the never-delete set. Page by keyset instead (order=id.asc, id=gt. largest seen): churn behind the cursor cannot shift rows ahead of it. The #6618 fail-closed page cap is unchanged. The test stub now honours id=gt. and a churn regression test (task 1 completes after page 1 of 1500) asserts the full set, task 1001 included. 21/21 janitor tests pass.
@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 05:07
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 562d42e5-f261-44fa-b64b-4c902d914478
Commits

Reviewing files that changed from the base of the PR and between 962dbfc and 63fb56e.

Files selected for processing: 2

  • infra/cargo-target-janitor/bin/cargo_target_janitor.py
  • infra/cargo-target-janitor/tests/test_cargo_target_janitor.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T05:09:19.787685Z 63fb56e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo-target-janitor(queue_claims): offset pagination over the live claimed set can skip a still-claimed task — it loses never-delete protection

1 participant